package demo;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;

/**
 * @author tongchen
 * @create 2022-11-28 21:02
 */
@WebServlet("/demo08")
public class ServletDemo7 extends ServletDemo2 {
    //重写getMethod


    @Override
    protected void getMethod(ServletRequest servletRequest, ServletResponse servletResponse) {
        //1.返回类型
        HttpServletRequest request=(HttpServletRequest) servletRequest;
        System.out.println(request.getMethod());
        //2.返回虚拟目录
        System.out.println(request.getContextPath());
        //3.获取统一目录
        System.out.println(request.getRequestURL());
        //4.获取请求参数
        System.out.println(request.getQueryString());
        //5.获取请求头
        System.out.println(request.getHeader("user-agent"));
    }
}
